package com.xrh.xdemo.api.request.queryRequest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserVsRoleQueryRequest {

    /**主键id */
	@ApiModelProperty("主键id")
	private Long id;

	/**用户id */
	@ApiModelProperty("用户id")
	private Long sysUserId;

	/**角色id */
	@ApiModelProperty("角色id")
	private Long sysRoleId;
    
    @ApiModelProperty(value = "当前页码" )
    private Integer pageNum = 1;

    @ApiModelProperty(value = "每页数量" )
    private Integer pageSize = 10;

	 //获取查询条件,注释部分要自己填写
	public <T> QueryWrapper<T> createQuery() {
			
		QueryWrapper<T> queryWrapper = new QueryWrapper<T>();
		
		if(id != null)
			queryWrapper.eq("id", id);

		if(sysUserId != null)
			queryWrapper.eq("sys_user_id", sysUserId);

		if(sysRoleId != null)
			queryWrapper.eq("sys_role_id", sysRoleId);


		return queryWrapper;
	}
		
	//获取分页
   public <T> Page<T> createPage(){
	   return new Page<>(pageNum , pageSize);
   }
	   
}
